import { defineStore } from 'pinia';
import { ref } from 'vue'
import { LoginVo } from '@/apis/types/User'

export const useUserStore = defineStore('user', () => {
  const userInfo = ref<LoginVo>({
    userId: null,
    username: null,
    goaliasToken: null
  })

  function setUserInfo(info: LoginVo) {
    userInfo.value = info
  }

  function clearUserInfo() {
    userInfo.value = null
  }
  return { userInfo, setUserInfo, clearUserInfo }
}, { persist: true })